<?php
// +---------------------------------------------------------------------------+
// | This file is part of the KnowledgebasePublisher package                   |
// | KnowledgebasePublisher - web based knowledgebase publisher tool           |
// |                                                                           |
// | Author:  Evgeny Leontev <eleontev@gmail.com>                              |
// | Copyright (c) 2005 Evgeny Leontev                                         |
// |                                                                           |
// | For the full copyright and license information, please view the LICENSE   |
// | file that was distributed with this source code.                          |
// +---------------------------------------------------------------------------+

class BulkFileEntry extends FileEntry
{
	

	function validate($values, $step) {
		
		require_once 'eleontev/Validator.php';
		
		$required = array('category');
		
		$values['_directory'] = str_replace(array('.', '..'), '', $values['directory']);
		$required = array('_directory', 'category');	
		
		$v =& new Validator($values, true);

		//if($step == 2) {
		//	$required = array();	
		//}
		
		// check for required first, return errors
		$v->requiredArray('required_msg', $required);
		if($v->getErrors()) {
			$this->errors =& $v->getErrors();
			return true;
		}
		
		if(!is_readable($values['_directory'])) {
			$v->setError('dir_not_readable_msg', 'directory');
		}
		
		if($v->getErrors()) {
			$this->errors =& $v->getErrors();
			return true;
		}
	}
}
?>